<template>
  <div class="sale_r_top">
    <div class="title">{{ title }}</div>
    <div class="flex">
      <div
        class="tips"
        :class="state.active == index ? 'active_txt' : ''"
        v-for="(item, index) in item"
        :key="index"
        @click="state.active = index"
      >
        {{ item.title }}
      </div>
    </div>
  </div>
</template>

<script setup>
import { reactive, ref, defineProps } from "vue";
const props = defineProps({
  title: {
    type: String,
  },
});
const state = reactive({
  active: 2,
});

const item = [
  {
    title: "近7天",
    value: 1,
  },
  {
    title: "近30天",
    value: 1,
  },
  {
    title: "本月",
    value: 1,
  },
  {
    title: "本年",
    value: 1,
  },
];
</script>

<style lang="less" scoped>
.title {
  font-weight: bold;
}
.sale_r_top {
  overflow: hidden;
  height: 30px;
  display: flex;
  justify-content: space-between;
}

.tips {
  padding: 0px 20px;
  height: 20px;
  border: 1px solid #e0e0e0;
  border-radius: 20px;
  display: flex;
  font-size: 12px;
  color: #000;
  cursor: pointer;
  margin-left: 10px;
}

.active_txt {
  border: 1px solid #4e84f2;
  color: #4e84f2;
}
</style>
